/*
 * SignInSystemMessageListItem.java
 * business
 *
 * Created by ChenTao on 2017/1/9.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.listview.displaylistitem;

import android.app.Activity;
import android.content.Context;
import android.view.View;

import com.yidiandao.business.data.bean.Message;
import com.yidiandao.business.ui.orderabout.orderdetail.OrderDetailActivity;
import com.yidiandao.business.ui.url.UrlActivity;
import com.yidiandao.business.ui.widget.listview.DisplayListItem;
import com.yidiandao.business.ui.widget.listview.viewholder.NormalSystemMessageHolder;

/**
 * 普通-系统通知-ListItem
 */
public class NormalSystemMessageListItem extends DisplayListItem<NormalSystemMessageHolder, Message> {

    public NormalSystemMessageListItem(Message s) {
        super(s);
    }

    @Override
    public void onShow(final Context context, NormalSystemMessageHolder holder) {
        holder.refreshUI(data);

        if (Message.Type.ORDER_PAY.equals(data.getType())) {
            holder.root.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    OrderDetailActivity.actionStart((Activity) context, data.getOrderId());
                }
            });
        } else {
            holder.root.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    UrlActivity.actionStart((Activity) context, data.getUrl());
                }
            });
        }
    }

    @Override
    public String getDisplayItemTag() {
        return NormalSystemMessageListItem.class.getSimpleName();
    }

    @Override
    public Class<NormalSystemMessageHolder> getViewHolderClazz() {
        return NormalSystemMessageHolder.class;
    }
}
